package paintapplication;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.ArrayList;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import paintdrawtools.PaintElement;

public class ComponentsPanel extends JPanel {
	JPanel actualPanel;
	ArrayList components = new ArrayList();
	ArrayList labels = new ArrayList();
	public ComponentsPanel() {
		setBackground(Color.darkGray);
     	setPreferredSize(new Dimension(150, 150));
		actualPanel = new JPanel();
		actualPanel.setBackground(Color.darkGray);
//		actualPanel.setPreferredSize(new Dimension(92, 768));
		actualPanel.setLayout(new GridLayout(0, 1, 0, 0));

		JScrollPane scrollPane = new JScrollPane(actualPanel,
				JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.setPreferredSize(new Dimension(150, 768));
		add(scrollPane);
	}
	
	public void addComponent(PaintElement toBadded){
		components.add(toBadded);
		JLabel theNewLabel = new JLabel(toBadded.getComponentView());
//		theNewLabel.setPreferredSize(new Dimension(92, 92));
		labels.add(theNewLabel);
		actualPanel.add(theNewLabel);
		validate();
		repaint();
	}
	
	public void removeComponent(){
		
	}
}
